from string import ascii_lowercase, digits
tar = digits+ascii_lowercase+'_'
k = int(input())
s = input()
t = s
ans = ''
for c in tar:
    s = s.replace(c*k, '')
vis = set(s)
s = t
for c in s:
    if c not in vis and c not in ans and c*k in t:
        ans += c
        t = t.replace(c*k, c)
print(ans, t, sep='\n')
# 2
# aaaaaa
